"""
行政区划 VO
"""

import utils.enum_utils as enum
from models import (
    VOBase,
    VOPage,
)
from my_typing import *
from utils.data_utils.special import ObjectIdStr
from utils.mock_utils import Demo
from utils.validator_utils.pydantic_validator.field import (
    CharField,
    ListField,
    NormalField,
)


class RegionListVO(VOBase):
    """ 行政区划 | 详情 | VO """

    id: ObjectIdStr = CharField(..., title="行政区划 ID（ObjectId 字符串）", examples=[Demo.id])
    code: str = CharField(..., title="行政区划 编号", examples=["33", "3301", "330102", "330102001"])
    name: str = CharField(..., title="行政区划 名称", examples=["浙江省", "杭州市", "上城区", "清波街道"])
    area_level: enum.RegionLevel = NormalField(..., title="行政区划 级别")


class RegionDetailVO(RegionListVO):
    """ 行政区划  | 详情 | VO """

    province_code: str = CharField(..., title="行政区划-省 编号", examples=["33"])
    city_code: StrOrNone = CharField(None, title="行政区划-市 编号", examples=["3301"])
    area_code: StrOrNone = CharField(None, title="行政区划-区 编号", examples=["330102"])
    street_code: StrOrNone = CharField(None, title="行政区划-街道 编号", examples=["330102001"])
    code_list: ListStr = ListField(..., title="编号列表", examples=[["33", "3301", "330102", "330102001"]])
    name_list: ListStr = ListField(..., title="名称列表", examples=[["浙江省", "杭州市", "上城区", "清波街道"]])


class RegionListPage(VOPage[RegionListVO]):
    """ 行政区划 | 列表 | 分页 """
